package cn.itcast.interceptor;

import cn.itcast.service.IpCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.Nullable;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * ClassName: IpCountInterceptor
 * Description:
 * Date: 2023/03/24 AM 12:51:11
 * <p>
 * project: springboot
 * package: cn.itcast.interceptor
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
public class IpCountInterceptor implements HandlerInterceptor {

    @Autowired
    private IpCountService ipCountService;


    @Override
    public boolean preHandle(@Nullable HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Object handler) throws Exception {
        ipCountService.count();
        return true;
    }
}
